using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using AudioDjStudio;

namespace IntelliTouchMix
{
	public partial class FormSoundInfo : Form
	{
		public FormSoundInfo()
		{
			InitializeComponent();
		}

		public FormMain	m_frmMain;

		int			m_nPlayer;
		int			m_nItem;
		string		m_strPathname;
        public static string ctl3dPushButtonExit_LoadTemplateFile = "";

		public void SetObject(int nPlayer, int nItem)
		{
			m_nPlayer = nPlayer;
			m_nItem = nItem;
		}

		private void FormSoundInfo_Load(object sender, EventArgs e)
		{
			// initialize the component that will be used for tags analysis
			audioDjStudio1.InitSoundSystem(1, 0, 0, 0, 0);

			m_strPathname = m_frmMain.audioDjStudio1.PlayListGetItemString((Int16) m_nPlayer, (Int16) m_nItem, enumPlayListStrings.PL_STRING_URL);
			audioDjStudio1.LoadSound (0, m_strPathname);

			audioDjStudio1.TagsReader.ALL_AnalyzeSoundOnPlayer (0);
			LabelTitle.Text += audioDjStudio1.TagsReader.ALL_CommonFrameGet(enumTagFields.TAG_FIELD_TITLE);
			LabelArtist.Text += audioDjStudio1.TagsReader.ALL_CommonFrameGet(enumTagFields.TAG_FIELD_ARTIST);
			LabelAlbum.Text += audioDjStudio1.TagsReader.ALL_CommonFrameGet(enumTagFields.TAG_FIELD_ALBUM);
			LabelYear.Text += audioDjStudio1.TagsReader.ALL_CommonFrameGet(enumTagFields.TAG_FIELD_YEAR);
			LabelComment.Text += audioDjStudio1.TagsReader.ALL_CommonFrameGet(enumTagFields.TAG_FIELD_COMMENT);
			LabelTrack.Text += audioDjStudio1.TagsReader.ALL_CommonFrameGet(enumTagFields.TAG_FIELD_TRACK);
			LabelGenreCode.Text += audioDjStudio1.TagsReader.ALL_CommonFrameGet(enumTagFields.TAG_FIELD_GENRE_CODE);
			LabelGenreString.Text += audioDjStudio1.TagsReader.ALL_CommonFrameGet(enumTagFields.TAG_FIELD_GENRE_STRING);

			LabelDuration.Text += audioDjStudio1.GetFormattedSoundDuration(0);

			SoundInfo2	info = new SoundInfo2();
			audioDjStudio1.ReadSoundInfo2 (0, ref info);
			LabelFreq.Text += info.nFrequency.ToString();
			LabelChannels.Text += info.nChannels.ToString();
		}

		private void ctl3dPushButtonExit_Click(object sender, EventArgs e)
		{
			Close();
		}
	}
}